﻿@model Command

@{
    var positions = new[] { "left1", "left2", "left3", 
        "center1", "center2", "center3", 
        "right1", "right2", "right3", "forest" };
}

<div class="info">Мини дота гайд @Html.ShowUserName(Model.Author) от @Model.Date 
    @Html.Action("Rating", "Home", new { id = Model.Id, controller = "Commands", current = Model.Raiting }) 
    @Html.RouteLink(" (обсудить)", "Command", new {id = Model.Id})
    @Html.Delete("Commands", Model.Id);
</div>

<table>
<tr>
    <td style="font-size:smaller" align=center colspan=3>лево/верх</td>
    <td rowspan=3 style="width:15px"></td>
    <td style="font-size:smaller" align=center colspan=3>центр</td>
    <td rowspan=3 style="width:15px"></td>
    <td style="font-size:smaller" align=center colspan=3>право/низ</td>
    <td rowspan=3 style="width:15px"></td>
    <td style="font-size:smaller" align=center>лес</td>
</tr>
@foreach (var g in Model.CommandsHeroes.GroupBy(h => h.Position[0]).Where(_=>_.Key != 'b'))
{
    <tr style="height:36px">
    @foreach (var p in positions)
    {            
        var heroc = g.FirstOrDefault(_=>_.Position.StartsWith(g.Key + p));           
              
        <td style="width:36px;padding-top:3px;background-color:LightGrey">  
            @if (heroc != null)
            {                                 
                @Html.LinkOnHero(heroc.Hero, isSmall:true)
            }
        </td>          
    }
    </tr>
}
</table>
    
<div>        
    @foreach (var hero in Model.CommandsHeroes.Where(_ => _.Position.StartsWith("blocked")).Select(_ => _.Hero))
    {
        @Html.LinkOnHero(hero, isSmall: true, strike: true);            
    }
</div>

@if ((bool?)ViewData["ShowCaption"] == true)
{   
    <div class="authorText">@Html.ReplaceKeyOnContent(Model.Comment, true)</div>   
}

@if ((bool?)ViewData["ShowComments"] == true)
{       
    <div style="margin-left:20px">    
        @Html.CompactComments(Url.RouteUrl("Command", new { id = Model.Id }))          
    </div>
}